package com.shangxia.monomer.study.math.formula;

/**
 * @author zhouya38158
 * @Package com.shangxia.monomer.study.math
 * @date 2021/7/22 9:26
 */
public class GreatestCommonDivisor {
    public static void main(String[] args) {
        System.out.println(gcd(8,40));
    }
    /**
     * 最大公约数
     * @param a
     * @param b
     * @return
     */
    public static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }
}
